# https://hub.docker.com/_/openjdk
FROM centos:7.5.1804

# set label
LABEL maintainer="seata <niao.shuai123@163.com>"

ADD . /seata

# set environment
ENV SEATA_USER="seata" \
    JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk" \
    JAVA="/usr/lib/jvm/java-1.8.0-openjdk/bin/java" \
    TIME_ZONE="Asia/Shanghai" \
    SEATA_CONFIG_NAME="file:/seata/conf/registry"

ARG SEATA_VERSION=1.4.2

WORKDIR /$BASE_DIR

RUN set -x \
    && yum update -y \
    && yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel wget iputils nc vim libcurl \
#    && wget https://github.com/seata/seata/releases/download/v${SEATA_VERSION}/seata-server-${SEATA_VERSION}.tar.gz -P /home \
#    && wget http://148.163.164.52:889/seata-server-${SEATA_VERSION}.tar.gz -P /home \
#    && mkdir /opt/seata \
#    && tar -xzvf /home/seata-server-${SEATA_VERSION}.tar.gz -C /home \
#    && rm -rf /home/seata-server-${SEATA_VERSION}.tar.gz \
    && ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo '$TIME_ZONE' > /etc/timezone \
    && yum clean all

# 设置额外参数
ENV EXTRA_JVM_ARGUMENTS="-XX:MaxDirectMemorySize=1024M"

ENTRYPOINT ["sh","/seata/bin/seata-server.sh","-p","8091","-h","127.0.0.1"]
EXPOSE 8091
